package com.glx.learn_spring.learn_spring_04_bean_lifecycle.service.impl;

import com.glx.learn_spring.learn_spring_04_bean_lifecycle.dao.IBookDao;
import com.glx.learn_spring.learn_spring_04_bean_lifecycle.service.IBookService;
import org.springframework.beans.factory.DisposableBean;
import org.springframework.beans.factory.InitializingBean;

/**
 * @author haoli
 * @create 2022/11/30 13:46
 */
public class BookServiceImpl implements IBookService, InitializingBean, DisposableBean {

    private IBookDao bookDao;

    @Override
    public void save() {
        System.out.println("bookService save ...");
        bookDao.save();
    }

    @Override
    public void afterPropertiesSet() throws Exception {
        System.out.println("bookService init ...");
    }

    @Override
    public void destroy() throws Exception {
        System.out.println("bookService destory ...");
    }

    public void setBookDao(IBookDao bookDao) {
        this.bookDao = bookDao;
    }
}
